//
//  BBButton.h
//  BattleFrontierV3
//
//  Created by Eric on 12/24/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "BBPackAction.h"
#import "BBOpacityNode.h"

typedef enum  {
	kBBButtonStateWaiting,
	kBBButtonStateTrackingTouch,
} BBButtonState;

typedef enum  {
    kBBButtonTouchModeDownInside,
	kBBButtonTouchModeUpInside
} BBButtonTouchMode;


#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@interface BBButton : BBOpacityNode<CCTargetedTouchDelegate> {
    BBButtonTouchMode touchMode;
    CCSprite *normal;
    CCSprite *selected;
    CCSprite *disabled;
    
    BBButtonState state;
    
    BOOL isEnabled;
    
    NSInteger priority;
    
    BBPackAction* pack;
}
@property(nonatomic)BOOL isEnabled;
@property(nonatomic)BBButtonTouchMode touchMode;
@property(nonatomic, retain)BBPackAction* pack;
-(void)initWithFrameName:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;
-(void)initWithFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;

-(BOOL)containsTouchLocation:(UITouch *)touch rect:(CGRect)r;
-(BOOL)containsTouchLocation:(UITouch *)touch;
+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack priority:(NSInteger)priority ;
+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack priority:(NSInteger)priority;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack;

+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority ;
+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled;
@end

#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
@interface BBButton : BBOpacityNode<CCMouseEventDelegate, CCKeyboardEventDelegate> {
    BBButtonTouchMode touchMode;
    CCSprite *normal;
    CCSprite *selected;
    CCSprite *disabled;
    
    BBButtonState state;
    
    BOOL isEnabled;
    
    NSInteger priority;
    
    BBPackAction* pack;
    
    NSMutableArray* keyCodes;
    NSMutableArray* keyMasks;   
}
@property(nonatomic)BOOL isEnabled;
@property(nonatomic)BBButtonTouchMode touchMode;
@property(nonatomic, retain)BBPackAction* pack;
-(void)initWithFrameName:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;
-(void)initWithFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;

-(BOOL)containsTouchLocation:(NSEvent*)event rect:(CGRect)r;
-(BOOL)containsTouchLocation:(NSEvent*)event;

-(void)addKeyCode:(unichar) keyCode;
-(void)addKeyMask:(NSUInteger) keyMask;

+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack priority:(NSInteger)priority ;
+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack priority:(NSInteger)priority;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled pack:(BBPackAction*)pack;

+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority ;
+(id)button:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled priority:(NSInteger)priority;
+(id)buttonFile:(NSString*)normal selected:(NSString*)selected disabled:(NSString*)disabled;
@end
#endif 


@interface BBCheckbox:  BBButton {
}
-(BOOL)isChecked;
-(void)checked:(BOOL)chk;
@end